package com.yuxl.ai.embedding.controller;

import com.yuxl.ai.embedding.service.EmbeddingApi;
import com.yuxl.common.core.annotation.Anonymous;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import java.util.List;

/**
 * @Author : yuxl
 * @create 2025/7/10 下午5:54
 */
@Tag(name = "向量模型")
@RequestMapping("/ai/embedding")
@RestController
@Anonymous
public class EmbeddingController {

    @Resource
    private EmbeddingApi embeddingApi;

    @Operation(summary = "text")
    @PostMapping("/text")
    public Mono<List<float[]>> text(@RequestBody List<String> texts) {
        return embeddingApi.embedding(texts);
    }
}
